<template>
  <div v-if="popup.isShow" class="definedPopup">
    <div class="box">
      <div class="cont">
        <img :src="popup.icon" alt="" />
        <div>
          <div class="title">{{ popup.title }}</div>
          <span class="desc">{{ popup.desc }}</span>
        </div>
      </div>
      <div class="btns">
        <el-button @click="handleCancel">{{ popup.cancel }}</el-button>
        <el-button
          @click="handleSure"
          :type="popup.type === 'del' ? 'danger' : 'primary'"
          >{{ popup.sure }}</el-button
        >
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: "definedPopup",
  props: ["popup"],
  data() {
    return {};
  },
  methods: {
    handleCancel() {
      this.$emit("handleCancel");
    },
    handleSure() {
      this.$emit("handleSure");
    },
  },
};
</script>
<style lang="scss" scoped>
.definedPopup {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  z-index: 9;
  .box {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 336px;
    background: #ffffff;
    border-radius: 4px;
    box-sizing: border-box;
    padding: 30px 30px 20px 30px;
    color: #333;
    .cont {
      display: flex;
      align-items: center;
      img {
        margin-right: 12px;
        width: 32px;
        height: 32px;
      }
      .title,
      .desc {
        text-align: left;
      }
      .title {
        margin-bottom: 6px;
        color: #000000;
        font-size: 16px;
      }
      .desc {
        text-align: left;
        color: #999;
        font-size: 12px;
      }
    }
    .btns {
      display: flex;
      justify-content: space-around;
      margin-top: 20px;
    }
  }
}
</style>
